﻿<%@ Page Language="C#" AutoEventWireup="true" Codebehind="EditUser.aspx.cs" Inherits="LabMS.Web.User.EditUser" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>用户信息</title>
    <link type="text/css" rel="stylesheet" href="../style/screen.css" />
    <!--[if lte IE 6]>
    <link type="text/css" rel="stylesheet" href="../style/ie6.css" />
    <![endif]-->
    <!--[if lte IE 7]>
    <link type="text/css" rel="stylesheet" href="../style/ie7.css" />
    <![endif]-->

    <script type="text/javascript">
    function OpenEditWin(frmWin,width,height) 
      {       
           var me; 
           me = window;  
           var ret = window.showModalDialog(frmWin,me,'dialogWidth='+width +'px;dialogHeight='+height+'px;help:no;status:no');
           if (ret != null) 
           { 
              document.getElementById('tb').value=ret[0];
              document.getElementById("tbRealName").value = ret[1];
           }  
      }
   function back()
   {
        if(window.opener ==null)
        {
            window.location.href="./UserDefault.aspx";
        }
        else
        {
            this.window.close();
        }
   }
    
    </script>

</head>
<body class="mainBody">
    <form id="uiForm" runat="server">
        <div class="main">
            <div id="pageInfo" class="clearfix">
                <div class="title">
                    <label>
                        <a href="UserDefault.aspx">用户管理</a>
                    </label>
                    &gt;
                    <label>
                        编辑用户</label>
                </div>
            </div>
        </div>
        <div id="ui">
            <p>
                <span></span>
                <asp:Button ID="btnSave" runat="server" Text="保存" CssClass="button" OnClick="btnSave_Click" />
                <asp:Button ID="tbAddRole" runat="server" Text="添加角色" CssClass="button" OnClick="tbAddRole_Click" />
                <input id="backbtn" type="button" class="button" runat="server" onclick="back()" value="返回" />
            </p>
            <p>
                <span>加入时间：</span><asp:Label ID="lblCreateTime" runat="server"></asp:Label>
            </p>
            <p>
                <span>用 户 名：</span><asp:TextBox ID="tbUserName" runat="server"></asp:TextBox>
            </p>
            <p>
                <span>真实姓名：</span><input type="button" class="button" id="ChooseRealName" value="..."
                    style="width: 22px" onclick="OpenEditWin('../User/ChooseTeacherRealName.aspx',500,400)" />
                <asp:TextBox ID="tbRealName" runat="server"></asp:TextBox>
            </p>
            <p>
                <span>密 &nbsp;&nbsp; 码：</span><asp:TextBox ID="tbPassword" runat="server"></asp:TextBox><asp:TextBox
                    ID="tb" runat="server"></asp:TextBox>
            </p>
        </div>
        <div class="main">
            <asp:GridView ID="gvRole" runat="server" AutoGenerateColumns="false" DataKeyNames="RoleId"
                CssClass="infoTable" Width="100%" OnRowCommand="gvRole_RowCommand" OnRowDataBound="gvRole_RowDataBound"
                OnRowCreated="gvRole_RowCreated">
                <Columns>
                    <asp:BoundField DataField="RoleId" Visible="false" />
                    <asp:BoundField HeaderText="角色名" DataField="RoleName" />
                    <asp:BoundField HeaderText="角色描述" DataField="RoleDetails" />
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="CancelRole" runat="server" Text="删除" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "RoleId")%>'
                                CommandName="cancleRole" OnClientClick="return confirm('你确定要删除？')"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <EmptyDataTemplate>
                    暂时没有数据！
                </EmptyDataTemplate>
                <HeaderStyle CssClass="header" />
                <RowStyle HorizontalAlign="Center" />
            </asp:GridView>
        </div>
        <asp:HiddenField ID="UserIDHF" runat="server" />
        <asp:HiddenField ID="UserNameHF" runat="server" />
    </form>

    <script type="text/javascript" src="../js/jQuery/jquery-1.3.1.js"></script>

    <script type="text/javascript" src="../js/jQuery/jquery.tooltip.js"></script>

    <script type="text/javascript" src="../js/jQuery/jquery.bgiframe.js"></script>

    <script type="text/javascript" src="../js/jQuery/jquery.validate.js"></script>

    <script type="text/javascript" src="../js/site.js"></script>

</body>
</html>

<script type="text/javascript">
      /* 页面验证 */
      $(function(){
        $("#uiForm").validate({
        
            rules: {
                    tbUserName: {
                        required: true,
                        maxlength: 50
                    },
                    tbRealName: {
                        required: true,
                        maxlength: 50
                    },
                    tbPassword: {
                        required: true,
                        maxlength:50
                    }
                },
                messages: {
                    tbUserName: {
                        required: "请输入用户名",
                        maxlength: "用户名长度不能超过50！"
                    },
                    tbRealName: {
                        required: "请输入真实姓名!",
                        maxlength: "真实姓名长度不能超过50!"
                    },
                    tbPassword: {
                        required: "密码不能为空",
                        maxlength:"密码不能超过50！"
                    }
                }
        });
        });
</script>

<script type="text/javascript">

        $(function(){
            /* 修改样式 */
            $("#gvRole > tbody > tr:even").not(":first").addClass("even");
            $("#gvRole > tbody > tr").not(":first")
                .hover(
                    function(){
                        $(this).addClass("hover");
                    },
                    function(){
                        $(this).removeClass("hover");
                });
                });
</script>

